import Vue from 'vue'
import VueRouter from './hash-router'
// 加载组件
import Layout from '@/components/Layout.vue'
import Index from '@/views/Index.vue'
import Login from '@/views/Login.vue'

Vue.use(VueRouter)

const routes = [

    {
        name: 'login',
        path: '/login',
        component: Login
    },
    // 嵌套路由
    {
        path: '/',
        component: Index,
        children: [

            {
                name: 'index',
                path: '',
                component: Index
            },
            {
                name: 'detail',
                path: 'detail/:id',
                props: true,
                component: () => import('@/views/Detail.vue')
            },

        ]
    }
]

const router = new VueRouter({
    mode: 'hash',
    routes
})


export default router
